/**
 * 
 */
package org.mhz.sit.entity;

import java.io.Serializable;

import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

import org.mhz.sit.util.Constants;

/**
 * @author Mahan
 *
 * Speaker entity
 */
@Entity
@Table(name = "speaker_t")
@SuppressWarnings("serial")
public class Speaker extends BaseSpeaker implements Serializable
{
    @Id
    @Column(name = "id") 
    private Integer mId;
    
    /**
     * Constructor
     */
    public Speaker()
    {
        super();
    }


    /**
     * @param aId - The id
     * @param aName - The name
     */
    public Speaker(final Integer aId, final String aName)
    {
        super(aName);
        mId = aId;
    }


    /**
     * @return Returns the id.
     */
    public Integer getId()
    {
        return mId;
    }

    /**
     * @param aId The id to set.
     */
    public void setId(final Integer aId)
    {
        mId = aId;
    }	 
    
    /**
     * @return The id as a property
     */
    public StringProperty idProperty() 
    { 
        if (mId == null)
        {
            final StringProperty id = new SimpleStringProperty(this, Constants.SPEAKER_ID_PROP);
            return id;
        }
        
        return new SimpleStringProperty(Integer.toString(mId));
    }


    /* (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString()
    {
        return "Speaker [Id=" + mId + ", Name=" + getName() + "]";
    }       
}
